package com.glp.services.impl;

import com.glp.dao.custom.ReportAuditMapper;
import com.glp.pojo.ReportAudit;
import com.glp.services.ReportAuditService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class ReportAuditServiceImpl implements ReportAuditService {
    @Autowired
    private ReportAuditMapper reportAuditMapper;
    @Override
    public ReportAudit getReportAuditByReportId(Integer reportId) {
        return reportAuditMapper.selectByReportId(reportId);
    }

    @Override
    public int remove(Integer reportId) {
        return reportAuditMapper.deleteByReportId(reportId);
    }

    @Override
    public int modifyStatusByReportId(Integer reportId, int status) {
        ReportAudit audit = getReportAuditByReportId(reportId);
        audit.setStatus(status);
        audit.setUpdateTime(new Date());
        return reportAuditMapper.updateByPrimaryKeySelective(audit);
    }


}
